import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from "vue-router"

import Login from "@/views/Login.vue"
import Register from "@/views/Register.vue"
import Home from "@/views/Home.vue"
import Main from "@/views/main/Main.vue"
import NotFind from "@/views/NotFind.vue"
import System from "@/views/system/System.vue"
import Charts from "@/views/charts/Charts.vue"

const routes: Array<RouteRecordRaw> = [
    {
        path: "/login",
        name: "Login",
        component: Login,
    },
    {
        path: "/register",
        name: "Register",
        component: Register
    },
    {
        path: "/chart",
        name: "Charts",
        component: Charts
    },
    {
        path: "/home",
        name: "Home",
        component: Home,
        children: [
            {
                path: "main",
                name: "Main",
                component: Main
            },
            {
                path: "system",
                name: "System",
                component: System
            },
        ]
    },
    {
        path: '/404',
        name:"NotFind",
        component:NotFind
    },
    {
        path: '/:pathMatch(.*)',
        redirect: '/404'
    }
]

const router = createRouter({
    routes,
    //代表history模式
    history: createWebHistory()
})

export default router